﻿using Timo.Logger.Extension;

namespace Timo.Logger;

/// <summary>
/// 日志格式化启动类
/// </summary>
[AppStartup(99)]
public class Startup : AppStartup
{
    public void ConfigureServices(IServiceCollection services)
    {
        //启动控制台日志格式化组件
        services.AddComponent<LoggingConsoleComponent>();
        //启动日志写入文件组件
        if (App.GetConfig<bool>("Logging:File:Enabled"))
            services.AddComponent<LoggingFileComponent>();
        //日志监听
        services.AddMonitorLogging(options =>
        {
            options.IgnorePropertyNames = new[] { "Byte" };
            options.IgnorePropertyTypes = new[] { typeof(byte[]) };
            //options.JsonBehavior = Furion.Logging.JsonBehavior.OnlyJson;
            //options.JsonIndented = true;    // 是否美化 JSON，Furion 4.8.0+ 版本有效
        });
        services.AddLogoDisplay();
    }

    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
    {
    }
}